package com.testing.sunnycommon.controller;

import com.testing.sunnycommon.model.Result;
import com.testing.sunnycommon.model.SunnyKeywords;
import com.testing.sunnycommon.service.SunnyKeywordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Classname SunnyKeywordsController
 * @Description 类型说明
 * @Date 2023/4/19 21:32
 * @Created by 特斯汀Roy
 */
@RestController
@RequestMapping("/sunnyKeywords")
public class SunnyKeywordsController {

    @Autowired
    SunnyKeywordsService sunnyKeywordsService;

    @GetMapping
    public Result<List<SunnyKeywords>> listSunnyKeywords(){
        return Result.success(sunnyKeywordsService.list());
    }

    @PutMapping
    public Result updateSunnyKeywords(@RequestBody SunnyKeywords sunnyKeywords){
        boolean result = sunnyKeywordsService.updateById(sunnyKeywords);
        if(result) {
            return Result.success("更新关键字成功");
        }else{
            return Result.fail(1010,"修改用例失败",sunnyKeywords);
        }
    }


}
